<template>
    <div>
        <div v-if="According">
            <div class="i-layout-page-header">
                <PageHeader hidden-breadcrumb>
                    <div slot="content" class="breadcrumbImg">
                        <img class="dashboard-workplace-header-avatar"
                            :src="info.head_img_url ? info.head_img_url : infoImg" alt="">
                        <div class="dashboard-workplace-header-tip">
                            <p class="dashboard-workplace-header-tip-title">{{timeStr}}</p>
                            <p class="dashboard-workplace-header-tip-desc">
                                今日{{weatherData.type}}，{{weatherData.low}}~{{weatherData.high}}，{{weatherTips}}
                            </p>
                        </div>
                    </div>
                    <div slot="extra" class="dashboard-workplace-header-extra">
                        <Row type="flex" justify="center" align="middle" :gutter="12">
                            <Col span="8">
                            <p>
                                <Avatar icon="md-apps" size="small" v-color="'#40a9ff'" v-bg-color="'#e6f7ff'" />
                                <span class="colorT">患者数</span>
                            </p>
                            <a class="colorL" href="javaScript:;" v-if="profession_type!== 0"
                                @click="handleJumpPage('patient')">{{callData.patientCount || 0}}</a>
                            <p class="colorL" v-if="profession_type === 0">{{callData.patientCount || 0}}</p>
                            </Col>
                            <Col span="8">
                            <p>
                                <Avatar icon="md-checkbox-outline" size="small" v-color="'#ffa940'"
                                    v-bg-color="'#fff7e6'" />
                                <span class="colorT">今日回访</span>
                            </p>
                            <p>
                                <a class="colorL" href="javaScript:;" v-if="profession_type!== 0">
                                    <Tooltip placement="top"
                                        :content="'已回访:'+(callData.completeCount || 0) + ' 待回访:' + (callData.unfinished || 0)">
                                        <a class="colorL" href="javaScript:;"
                                            @click="handleJumpPage('visitNo')">{{callData.completeCount || 0}}</a> /
                                        <a class="colorL" href="javaScript:;"
                                            @click="handleJumpPage('visit')">{{callData.unfinished || 0}}</a>
                                    </Tooltip>
                                </a>
                                <Tooltip class="colorL" v-else placement="top"
                                    :content="'已回访:'+(callData.completeCount || 0) + ' 待回访:' + (callData.unfinished || 0)">
                                    {{callData.completeCount || 0}} / {{callData.unfinished || 0}}</Tooltip>
                            </p>
                            </Col>
                            <Col span="8">
                            <p>
                                <Avatar icon="md-apps" size="small" v-color="'#40a9ff'" v-bg-color="'#e6f7ff'" />
                                <span class="colorT">过期未回访</span>
                            </p>
                            <a class="colorL" href="javaScript:;" v-if="profession_type!== 0"
                                @click="handleJumpPage('overdue')">{{callData.overdue || 0}}</a>
                            <p class="colorL" v-else>{{callData.overdue || 0}}</p>
                            </Col>
                        </Row>
                    </div>
                </PageHeader>
            </div>
            <Tabs value="1" @on-click="switchsa" class="daibansx" :animated="false">
                <TabPane label="今日待访" name="1">
                    <Row :gutter="24">
                        <Card :bordered="false" dis-hover class="ivu-mt">
                            <table-form :labels="labelList" :types="typeList" ref="searchForm" @search="onSearch" />
                            <div class="i-table-no-border" ref="table">
                                <Table size="small" ref="table" :columns="columns" :data="data" :loading="loading"
                                    @on-sort-change="handleChangeSort">
                                    <template slot-scope="{ row }" slot="info">
                                        <a href="javaScript:;" @click="handleDetailPatient(row)">{{ row.name }} ,
                                            {{ row.age }} , {{ row.gender_str }}</a>
                                    </template>
                                    <template slot-scope="{row}" slot="outpatient_name">
                                        <Tag class="blueStatus" v-if="row.outpatient_name" color="blue">
                                            {{ row.outpatient_name }}</Tag>
                                    </template>
                                    <template slot-scope="{ row }" slot="patient_tags_name_arr">
                                        <Poptip word-wrap trigger="hover" placement="right" width="400">
                                            <Tag v-for="(item, index) in row.patient_tags_name_arr" :key="index"
                                                v-if="index < 3">{{ item }}</Tag>
                                            <div slot="content">
                                                <Tag v-for="(item, index) in row.patient_tags_name_arr" :key="index">
                                                    {{ item }}</Tag>
                                            </div>
                                        </Poptip>
                                    </template>
                                    <template slot-scope="{ row }" slot="remark">
                                        <span v-if="row.remark">
                                            <span v-if="row.remark.length < 12">
                                                {{row.remark}}
                                            </span>
                                            <Poptip v-else word-wrap transfer trigger="hover" placement="bottom"
                                                width="200" :content="row.remark">
                                                {{row.remark.substring(0, 11)}}…
                                            </Poptip>
                                        </span>
                                        <span v-else>无</span>
                                    </template>
                                    <template slot-scope="{ row, index }" slot="action">
                                        <a @click="handleSubmit(row)">回访</a>
                                    </template>
                                </Table>
                                <div class="ivu-mt ivu-text-center">
                                    <Page :total="total" :current.sync="page" show-total show-elevator transfer
                                        :page-size="pageSize" @on-change="changePage" :page-size-opts="pageOpts"
                                        show-sizer @on-page-size-change="changepageSize" />
                                </div>
                            </div>
                            <table-model ref="editModel" @close="closeEdit" />
                        </Card>
                    </Row>
                </TabPane>
                <TabPane label="信息待完善" name="2">
                    <Row :gutter="24">
                        <Card :bordered="false" dis-hover class="ivu-mt">
                            <table-form :labels="labelList" :types="typeList" ref="searchForm" @search="onSearch" />
                            <div class="i-table-no-border" ref="table">
                                <Table size="small" ref="table" :columns="columns1" :data="arr" :loading="loading"
                                    @on-sort-change="handleChangeSort">
                                    <template slot-scope="{ row }" slot="info">
                                        <a href="javaScript:;" @click="handleDetailPatient(row)">{{ row.name }} ,
                                            {{ row.age }} , {{ row.gender_str }}</a>
                                    </template>
                                    <template slot-scope="{row}" slot="outpatient_name">
                                        <Tag class="blueStatus" v-if="row.outpatient_name" color="blue">
                                            {{ row.outpatient_name }}</Tag>
                                    </template>
                                    <template slot-scope="{ row }" slot="patient_tags_name_arr">
                                        <Poptip word-wrap trigger="hover" placement="right" width="400">
                                            <Tag v-for="(item, index) in row.patient_tags_name_arr" :key="index"
                                                v-if="index < 3">{{ item }}</Tag>
                                            <div slot="content">
                                                <Tag type="border" v-for="(item,index) in row.patient_tags_name_arr"
                                                    :key="index" color="primary">{{item}}</Tag>
                                            </div>
                                        </Poptip>
                                    </template>
                                    <template slot-scope="{ row }" slot="remark">
                                        <span v-if="row.last_callback">
                                            <span v-if="row.last_callback.length < 12">
                                                {{row.last_callback}}
                                            </span>
                                            <Poptip v-else word-wrap transfer trigger="hover" placement="bottom"
                                                width="200" :content="row.last_callback">
                                                {{row.last_callback.substring(0, 11)}}…
                                            </Poptip>
                                        </span>
                                        <span v-else>无</span>
                                    </template>
                                    <template slot-scope="{ row, index }" slot="action">
                                        <a @click="Submitsss(row)">完善</a>
                                    </template>
                                </Table>
                                <div class="ivu-mt ivu-text-center">
                                    <Page :total="total" :current.sync="page" show-total show-elevator transfer
                                        :page-size="pageSize" @on-change="changePage" :page-size-opts="pageOpts"
                                        show-sizer @on-page-size-change="changepageSize" />
                                </div>
                            </div>
                            <table-model ref="editModel" @close="closeEdit" />
                        </Card>
                    </Row>
                </TabPane>
                <TabPane label="任务列表" name="3">
                    <tasklist ref="tasklist" />
                </TabPane>
            </Tabs>
        </div>
        <div>
            <Card v-if="!According">
                <div style="display: flex;justify-content: center;">
                    <Input style="width: 40%;" class="searchinput" v-model="keywords" placeholder="请输入患者姓名/诊疗号/手机号搜索患者选择要治疗的项目" @on-enter="search"
                        suffix="ios-search"></Input>
                </div>
                <Tabs :value="tabPane" @on-click="switchsaa">
                    <TabPane :label="label" name="1">
                        <Form>
                            <Row :gutter="12" type="flex">
                                <Col span="5">
                                <FormItem prop="keywords2">
                                    <Input v-model="keywords2" placeholder="请输入患者姓名或诊疗号"
                                        @keydown.native.enter.prevent="searchs"></Input>
                                </FormItem>
                                </Col>
                                <Col span="4" class="ivu-mb-16">
                                <FormItem prop="clinic_project_ids">
                                    <Select v-model="clinic_project_ids" :clearable="true" placeholder="治疗项目选择"
                                        @on-change="TheQuerys" @on-clear="emptys">
                                        <Option v-for="item in clinic_project" :key="item.value" :value="item.value"
                                            :disabled="+item.status === 0">
                                            {{ item.title }}</Option>
                                    </Select>
                                </FormItem>
                                </Col>
                            </Row>
                            <Row :gutter="24">
                                <span v-if="show"
                                    style="margin-left: 50%;height: 100px;display: block;margin-top: 20px">暂无数据</span>
                                <Col span="6" v-for="(item , index) in  waitList" :key="index">
                                <Card style="margin-bottom: 25px">
                                    <p slot="title">
                                        {{item.name}}&nbsp;&nbsp;&nbsp;{{item.gender}}&nbsp;&nbsp;&nbsp;{{item.age}}</p>
                                    <tag slot="extra">{{item.patient_card_id}}</tag>
                                    <tag slot="extra">{{item.clinic_name}}</tag>
                                    <Row class="ivu-mb-16">
                                        <Col span="12">正常剩余： {{item.total_num}}</Col>
                                        <Col span="12">援助剩余：{{item.help_num}}</Col>
                                    </Row>
                                    <Divider class="ivu-m-0"> </Divider>
                                    <Row class="ivu-mt-8">
                                        <Col span="18" class="ivu-mt-8">{{item.clinic_project_name}}</Col>
                                        <Col span="6" class="ivu-text-right"><Button type="primary"
                                            @click="handleAddTreatment(item, index)">治疗</Button></Col>
                                    </Row>
                                </Card>
                                </Col>
                            </Row>
                            <div class="ivu-mt ivu-text-center">
                                <Page :total="dataTotalsing" :current.sync="pages" show-total show-elevator
                                    :page-size="pageSizes" @on-change="handleChangePage" :page-size-opts="pageOptss"
                                    show-sizer transfer @on-page-size-change="handleChangepageSize" />
                            </div>
                        </Form>
                    </TabPane>
                    <TabPane :label="labels" name="2">
                        <Form>
                            <Row :gutter="12" type="flex">
                                <Col span="4">
                                <DatePicker type="date" :options="options3" v-model="date" :clearable="false"
                                    split-panels @on-change="SearchEntered" placeholder="请输入已治疗日期"></DatePicker>
                                </Col>
                                <Col span="5">
                                <Input @on-enter="SearchEntered" v-model="keywords2" placeholder="请输入患者姓名或诊疗号" />
                                </Col>
                                <Col span="4" class="ivu-mb-16">
                                <FormItem prop="clinic_project_ids">
                                    <Select v-model="clinic_project_ids" placeholder="治疗项目选择" :clearable="true"
                                        @on-change="SearchEntered" @on-clear="emptyProject">
                                        <Option v-for="item in clinic_project" :key="item.value" :value="item.value"
                                            :disabled="+item.status === 0">
                                            {{ item.title }}</Option>
                                    </Select>
                                </FormItem>
                                </Col>
                            </Row>
                            <Row :gutter="24">
                                <span v-if="shows"
                                    style="margin-left: 50%;height: 100px;display: block;margin-top: 20px">暂无数据</span>
                                <Col span="6" v-for="(item , index) in  waitLists" :key="index">
                                <div @click="detailed(item)">
                                    <Card style="margin-top: 10px">
                                        <p slot="title">
                                            {{item.name}}&nbsp;&nbsp;&nbsp;{{item.gender}}&nbsp;&nbsp;&nbsp;{{item.age}}
                                        </p>
                                        <tag slot="extra">{{item.patient_card_id}}</tag>
                                        <tag slot="extra">{{item.clinic_name}}</tag>
                                        <Row class="ivu-mb-16">
                                            <Col span="12">操作人： {{item.operate_name}}</Col>
                                            <Col span="12">治疗个数：{{item.all_num}}</Col>
                                            <Col span="24" class="ivu-mt-8">时间：{{item.recently_clinic_time}}</Col>
                                        </Row>
                                        <Divider class="ivu-m-0"> </Divider>
                                        <Row class="ivu-mt-8">
                                            <Col span="16" class="ivu-mt-8">{{item.clinic_project_name}}</Col>
                                            <Col span="8" :col="2" class="ivu-text-right">
                                            <Button style="margin-top: 5px" size="small" :disabled="!item.modify"
                                                type="primary" @click.stop="handleAdd(item,index)">修改</Button>
                                            <Button style="margin-left: 5px;margin-top: 5px" @click.stop="undo(item.id)"
                                                v-if="item.isShow" size="small">撤销</Button>
                                            </Col>
                                        </Row>
                                    </Card>
                                </div>
                                </Col>
                            </Row>
                            <div class="ivu-mt ivu-text-center">
                                <Page :total="dataTotal" :current.sync="pages" show-total show-elevator transfer
                                    :page-size="pageSizes" @on-change="handleChangePage" :page-size-opts="pageOptss"
                                    show-sizer @on-page-size-change="handleChangepageSize" />
                            </div>
                        </Form>
                    </TabPane>
                </Tabs>
                <Modal :width="70" v-model="modal3" title="选择治疗项目" :mask-closable="false" draggable @on-ok="confirms" @on-cancel="ShutDown">
                    <Tabs v-model="data.tableList">
                        <TabPane :label="`${item.name}  ${item.gender}  ${item.age}  诊疗号：${item.patient_card_id}`" :name="item.patient_card_id" v-for="(item, index) of data.list" :key="index">
                            <Row :gutter="16" type="flex" justify="start">
                                <Col :span="parseInt(24/item.projectArray.length)<8?8:parseInt(24/item.projectArray.length)" v-for="items in item.projectArray" :key="items.id">
                                    <Card dis-hover>
                                        <p slot="title">{{items.room_name}}</p>
                                        <template v-for="iteming in items.children"> 
                                            <Tag checkable color="primary" :checked="item.clinic_project_ids.indexOf(iteming.clinic_project_id)>=0" :name="iteming.clinic_project_id" :key="iteming.clinic_project_id" @on-change="TheQuery">
                                                <font style="font-size:14px;">{{iteming.project_name}}</font>
                                            </Tag>
                                        </template>
                                    </Card>
                                </Col>
                            </Row>
                        </TabPane>
                    </Tabs>
                </Modal>
                <Modal v-model="modal4" title="撤销治疗" draggable @on-ok="confirmss" @on-cancel="ShutDown">
                    <p>你确定要撤销吗？</p>
                </Modal>
            </Card>
        </div>
        <Modal ref="endInfo" v-model="modal1" title="信息完善" draggable :mask-closable="false" width="40%" @on-ok="ok(perfect)"
            @on-cancel="cancel">
            <Form ref="form">
                <Row :gutter="24" type="flex">
                    <Progress :percent="parseInt(improved)" status="active" />
                    <Col>

                    <FormItem label="姓名" prop="disease" label-for="disease">
                        <span class="requiceIcon">*</span>
                        <Input v-model="DataName" element-id="name" @on-change="setName" />
                    </FormItem>
                    </Col>
                    <Col>
                    <FormItem label="手机号" prop="disease">
                        <span class="requiceIcon">*</span>
                        <!-- @on-change="perfects" -->
                        <Input v-model="perfect.mobile" @on-change="perfects" />
                    </FormItem>
                    </Col>
                    <Col>
                    <FormItem label="性别">
                        <RadioGroup v-model="disabledSingle">
                            <Radio v-for="item in gender" :key="item.id" :label="item.id">{{item.name}}
                            </Radio>
                        </RadioGroup>
                    </FormItem>
                    </Col>
                    <Col>
                    <FormItem label="城市" prop="perfect.city_id" label-for="perfect.city_id">
                        <Select clearable v-model="perfect.city_id" placeholder="请输入城市拼音简写" style="width:250px"
                            @on-select="progres" @on-clear="empty" filterable remote clearable
                            :remote-method="handleQueryText">
                            <Option v-for="item in city_list" :key="item.id" :value="item.key"
                                :disabled="+item.status === 0">{{ item.name }}</Option>
                        </Select>
                    </FormItem>
                    </Col>
                    <Col>
                    <FormItem label="病种" prop="perfect.patient_diseases_id" label-for="perfect.patient_diseases_id">
                        <Select clearable v-model="perfect.patient_diseases_id" style="width:250px" @on-select="progre"
                            @on-clear="empty">
                            <Option v-for="item in patient_diseases" :value="item.id" :key="item.id"
                                :disabled="+item.status === 0">{{item.name}}
                            </Option>
                        </Select>
                    </FormItem>
                    </Col>
                    <Col>
                    <FormItem label="部位" prop="perfect.body_parts_id" label-for="perfect.body_parts_id">
                        <Select v-model="perfect.body_parts_id" style="width:250px" @on-open-change="allowedChange"
                            @on-change="progress" multiple>
                            <Option v-for="item in body_parts" :value="item.id" :key="item.id"
                                :disabled="+item.status === 0">{{item.name}} </Option>
                        </Select>
                    </FormItem>
                    </Col>
                    <Col>
                    <FormItem label="标签" prop="perfect.tagsState_id" label-for="perfect.tagsState_id">
                        <Select v-model="perfect.tagsState_id" style="width:250px" multiple @on-change="changeTag"
                            @on-open-change="changeTags" :max-tag-count="2">
                            <OptionGroup v-for="item in tagsState" :key="item.value" :label="item.name">
                                <Option v-for="items in item.children" :value="items.id" :key="items.id"
                                    :disabled="+items.status === 0">
                                    {{ items.name }}
                                </Option>
                            </OptionGroup>
                        </Select>
                    </FormItem>
                    </Col>
                    <Col>
                    <FormItem label="风控类型" prop="perfect.risk_type_list_id" label-for="perfect.risk_type_list_id">
                        <Select clearable v-model="perfect.risk_type_list_id" style="width:250px"
                            @on-select="riskProgre" @on-clear="emptyRisk">
                            <Option v-for="item in risk_type_list" :value="item.id" :key="item.id"
                                :disabled="+item.status === 0">{{item.name}}
                            </Option>
                        </Select>
                    </FormItem>
                    </Col>
                    <Col>
                    <FormItem label="效果类型" prop="perfect.effect_type_list_id" label-for="perfect.effect_type_list_id"
                        v-if="!is_first_initially">
                        <Select clearable v-model="perfect.effect_type_list_id" @on-clear="emptyEffect"
                            style="width:250px" @on-select="effectProgre">
                            <Option v-for="item in effect_type_list" :value="item.id" :key="item.id"
                                :disabled="+item.status === 0">{{item.name}}
                            </Option>
                        </Select>
                    </FormItem>
                    </Col>
                </Row>
            </Form>
            <div slot="footer">
                <Button @click="cancel" style="margin-left: 8px">取消</Button>
                <Button type="primary" @click="ok(perfect)">确定</Button>
            </div>
        </Modal>
        <template-fore @putMessage="putMessage" @closeDrawer="onLoad" @edit="editList" ref="TemplateFore"></template-fore>
        <table-drawer :projects="projectList" ref="tableDrawer"></table-drawer>
        <!-- <div v-if="showTetailDrawer"> -->
        <Drawer :closable="false" v-model="showTetailDrawer" width="1000" class="edtailDrawers">
            <detailDrawer editType="3" v-if="patientId" :patientId="patientId"></detailDrawer>
        </Drawer>
        <!-- </div> -->
    </div>
</template>
<script>
    import axiosApi from 'axios';
    import { mapState, mapMutations } from 'vuex';
    import tableForm from './table-form';
    import tableModel from '@/components/visitModel/table-model';
    import { formatWithYear } from '@/utils/datetime';
    import { GetToDoList, GetUnImproved, GetImproved, clinicList, WaitList, AddclinicList, NewTreatment, GetEntryList, revocationTreatment } from '@api/dashboard';
    import TemplateFore from '../../treatment/list/templateFore'
    import tableDrawer from '../../treatment/list/table-drawer'
    import tasklist from './tasklist'
    import { searchCity } from '@/api/patient'
    import detailDrawer from '../../patient/patient-detail/index.vue'

    import dayjs from 'dayjs';
    export default {
        name: 'dashboard-workplace',
        components: { detailDrawer, tableForm, tableModel, TemplateFore, tableDrawer, tasklist },
        data() {
            return {
                label: (h) => {
                    let a = this.dataTotal
                    return h('div', [
                        h('span', '待录入')
                    ])
                },
                labels: (h) => {
                    return h('div', [
                        h('span', '已录入')
                    ])
                },
                projectList: [],
                tabPane: '1',
                According: true,
                showTetailDrawer: false,
                patientId: null,
                tab: '1',
                treatment_room_id: '',
                keywords2: '',
                show: false,
                border: [],
                modal3: false,
                keywords: '',
                names: true,
                mobile: '',
                arr: [],
                disabledSingle: '',
                modal1: false,
                loading: false,
                gender: [],
                infoImg: require('@/assets/images/avater.png'),
                columns: [
                    {
                        title: '基本信息',
                        slot: 'info',
                        minWidth: 130,
                        fixed: 'left'
                    },
                    {
                        title: '诊疗号',
                        key: 'patient_card_id',
                        minWidth: 140
                    },
                    {
                        title: '诊室',
                        key: 'clinic_name',
                        minWidth: 80
                    },
                    {
                        title: '归属人',
                        key: 'belong_member_name',
                        minWidth: 80
                    },
                    {
                        title: '上次到诊',
                        key: 'last_revisiting_time_str',
                        sortable: true,
                        minWidth: 110
                    },
                    {
                        title: '下次复诊',
                        key: 'next_revisiting_time_str',
                        sortable: true,
                        minWidth: 110
                    },
                    {
                        title: '上次回访时间',
                        key: 'last_callback_time_str',
                        sortable: true,
                        minWidth: 150
                    },
                    {
                        title: '下次回访时间',
                        key: 'next_callback_time_str',
                        sortable: true,
                        minWidth: 150
                    },
                    {
                        title: '就诊类型',
                        slot: 'outpatient_name',
                        minWidth: 100
                    },
                    {
                        title: '患者标签',
                        slot: 'patient_tags_name_arr',
                        minWidth: 100
                    },
                    {
                        title: '复诊次数',
                        key: 'revisiting_count',
                        sortable: 'custom',
                        minWidth: 110
                    },
                    {
                        title: '未到诊天数',
                        key: 'missed_days',
                        sortable: 'custom',
                        minWidth: 120
                    },
                    {
                        title: '地区',
                        key: 'city_name',
                        minWidth: 100
                    },
                    {
                        title: '来源',
                        minWidth: 120,
                        key: 'source_name'
                    },
                    {
                        title: '备注',
                        minWidth: 120,
                        slot: 'remark'
                    },
                    {
                        title: '操作',
                        minWidth: 60,
                        slot: 'action',
                        fixed: 'right'
                    }
                ],
                columns1: [
                    {
                        title: '基本信息',
                        slot: 'info',
                        minWidth: 130,
                        fixed: 'left'
                    },
                    {
                        title: '完善度',
                        // sortable: true,
                        sortable: 'custom',
                        key: 'improved',
                        minWidth: 100
                    },
                    {
                        title: '诊疗号',
                        key: 'patient_card_id',
                        minWidth: 140
                    },
                    {
                        title: '诊室',
                        key: 'clinic_name',
                        minWidth: 80
                    },
                    {
                        title: '上次到诊',
                        key: 'last_revisiting_time_str',
                        sortable: true,
                        minWidth: 110
                    },
                    {
                        title: '下次复诊',
                        key: 'next_revisiting_time_str',
                        sortable: true,
                        minWidth: 110
                    },
                    {
                        title: '上次回访时间',
                        key: 'last_callback_time_str',
                        sortable: true,
                        minWidth: 150
                    },
                    {
                        title: '就诊类型',
                        slot: 'outpatient_name',
                        minWidth: 100
                    },
                    {
                        title: '患者标签',
                        slot: 'patient_tags_name_arr',
                        width: 180
                    },
                    {
                        title: '复诊次数',
                        key: 'revisiting_count',
                        // sortable: true,
                        sortable: 'custom',
                        minWidth: 110
                    },
                    {
                        title: '未到诊天数',
                        key: 'missed_days',
                        // sortable: true,
                        sortable: 'custom',
                        minWidth: 120
                    },
                    {
                        title: '地区',
                        key: 'city_name',
                        minWidth: 100
                    },
                    {
                        title: '来源',
                        minWidth: 120,
                        key: 'source_name'
                    },
                    {
                        title: '最近回访内容',
                        key: 'last_callback',
                        minWidth: 120,
                        slot: 'remark'
                    },
                    {
                        title: '操作',
                        minWidth: 60,
                        slot: 'action',
                        fixed: 'right'
                    }
                ],
                data: [],
                modal4: false,
                page: 1,
                pageOptss: [8, 12, 16, 20],
                pageSize: 10,
                pageOpts: [10, 20, 30, 50],
                total: 0,
                labelList: [],
                typeList: [],
                searchForm: {},
                modal: false,
                callData: {},
                weatherData: {},
                weatherTips: '',
                timeStr: '',
                tagsState: [],
                tagsState_id: '',
                effect_type_list: [],
                effect_type_list_id: '',
                risk_type_list: [],
                risk_type_list_id: '',
                profession_type: 0,
                perfect: [],
                body_parts: [],
                city: [],
                patient_diseases: [],
                marketing_stage: [],
                num: '',
                name: '1',
                improved: '',
                isShow: true,
                body_parts_id: '',
                patient_diseases_id: '',
                city_id: '',
                DataList: [],
                waitList: [],
                dataTotal: 0,
                pages: 1,
                pageSizes: 8,
                clinic_project: [],
                clinic_project_ids: '',
                getConfigId: {
                    clinic_project_id: '',
                    treatment_room_id: ''
                },
                date: '',
                options3: {
                    disabledDate(date) {
                        return date && date.valueOf() > Date.now();
                    }
                },
                revocationTreatment_id: '',
                DataName: '',
                oldId: '',
                waitLists: [],
                shows: true,
                could_update: false,
                couldUpdate: false,
                could_update1: false,
                couldUpdate1: false,
                dataTotals: 0,
                dataTotalsing: 0,
                city_list: [],
                sort_degree_type: 0,
                last_callback_time_type: 0,
                next_revisiting_time_type: 0,
                last_revisiting_time_type: 0,
                sort_missed_type: 0,
                sort_revisiting_type: 0,
                is_first_initially: false
            }
        },
        created() {
            let is_nurse = localStorage.getItem('is_nurse')
            if (is_nurse === '0') {
                this.According = true
            } else {
                this.According = false
            }
            if (this.tabPane === '1') {
                this.WaitListS()
            } else {
                this.GetDate()
                this.EntryList()
            }
            this.initTime();
            this.initWeather();
            this.onLoad();
            this.GetDate()
            this.EntryList()
            this.judgeWaitListS()
        },
        methods: {
            ...mapMutations({
                changeReturnVisitTab: "admin/page/changeReturnVisitTab",
                changeMedicalListTab: "admin/page/changeMedicalListTab",
            }),
            closeDrawer() {
                this.getData()
            },
            // changeTag(value) {
            //     console.log(this.num)
            //     if (value.length) {
            //         this.num = parseInt(this.improved)
            //         this.improved = this.num + 10
            //     } else {
            //         this.num = parseInt(this.improved)
            //         this.improved = this.num - 10
            //     }
            //     // console.log(this.perfect.tagsState_id)
            // },
            // 排序
            handleChangeSort(column) {
                this.sort_degree_type = 0
                this.last_callback_time_type = 0
                this.next_revisiting_time_type = 0
                this.last_revisiting_time_type = 0
                this.sort_missed_type = 0
                this.sort_revisiting_type = 0
                switch (column.key) {
                    case 'last_revisiting_time_str':
                        column.order === 'asc' ? this.last_revisiting_time_type = 1 : this.last_revisiting_time_type = 2
                        break;
                    case 'next_revisiting_time_str':
                        column.order === 'asc' ? this.next_revisiting_time_type = 1 : this.next_revisiting_time_type = 2
                        break;
                    case 'last_callback_time_str':
                        column.order === 'asc' ? this.last_callback_time_type = 1 : this.last_callback_time_type = 2
                        break;
                    case 'revisiting_count':
                        column.order === 'asc' ? this.sort_revisiting_type = 1 : this.sort_revisiting_type = 2
                        break;
                    case 'missed_days':
                        column.order === 'asc' ? this.sort_missed_type = 1 : this.sort_missed_type = 2
                        break;
                    case 'improved':
                        column.order === 'asc' ? this.sort_degree_type = 1 : this.sort_degree_type = 2
                        break;
                }
                if (this.name === '1') {
                    this.onLoad()
                } else {
                    this.getData()
                }
            },
            handleQueryText(query) {
                if (query !== '') {
                    if (parseFloat(query).toString() !== 'NaN') query = query.slice(6, query.length)
                    return new Promise(resolve => {
                        setTimeout(() => {
                            searchCity({
                                keywords: query
                            }).then(res => {
                                if (res.list && res.list.length > 0) {
                                    let list = res.list.map(item => {
                                        return {
                                            key: item.id + query,
                                            id: item.id,
                                            name: item.name
                                        };
                                    })
                                    this.city_list = list
                                }
                                resolve(res.data)
                            })
                        }, 200)
                    })
                }
            },
            //
            emptys() {
                this.WaitListS()
            },
            // 下拉框清空
            emptyProject() {
                this.EntryList()
            },

            // 下拉框打开或关闭
            changeTags(value) {
                if (this.perfect.tagsState_id && this.perfect.tagsState_id.length === 0) {
                    this.couldUpdate1 = true
                }
                this.could_update1 = value
            },

            // 下拉框打开或关闭
            allowedChange(value) {
                if (this.perfect.body_parts_id && this.perfect.body_parts_id.length === 0) {
                    this.couldUpdate = true
                }
                this.could_update = value
            },
            // 治疗详细
            detailed(row) {
                this.oldId = row.id
                this.$refs.tableDrawer.handleDetail(row, false, row.template)
            },
            // 治疗记录
            editList(id, temp) {
                this.$refs.tableDrawer.handleDetail({ id: this.oldId, patient_card_id: id, clinic_project_id: this.getConfigId.clinic_project_id }, 1, temp)
            },
            // 清空下拉框
            empty() {
                this.num = parseInt(this.improved)
                this.improved = this.num - 10
            },
            emptyRisk() {
                this.perfect.risk_type_list_id = ''
                this.num = parseInt(this.improved)
                this.improved = this.num - 10
            },
            emptyEffect() {
                this.perfect.effect_type_list_id = ''
                this.num = parseInt(this.improved)
                this.improved = this.num - 10
            },
            // 撤销治疗
            confirmss(id) {
                revocationTreatment({ id: this.revocationTreatment_id }).then(res => {
                    this.EntryList()
                })
            },
            // 撤销治疗弹框
            undo(id) {
                this.revocationTreatment_id = id
                this.modal4 = true
            },
            // 搜索已录入
            SearchEntered() {
                this.EntryList()
            },
            // 获取日期
            GetDate() {
                let time = new Date()
                this.date = dayjs(time).format('YYYY-MM-DD')
            },
            // 修改
            handleAdd(row, index) {
                this.oldId = row.id
                // console.log(row,index,'<+=====================')
                this.getConfigId.clinic_project_id = row.clinic_project_id
                this.$refs.TemplateFore.templateList(row, row.template, this.waitLists[index].clinic_project_name, 1, this.getConfigId, 2, null)
            },
            // 切换待录入
            switchsaa(e) {
                this.tab = e
                this.pages = 1
                this.pageSizes = 8
                this.dataTotal = 0
                this.keywords2 = ''
                this.clinic_project_ids = ''
                this.waitList = []
                if (e === '2') {
                    this.GetDate()
                    this.EntryList()
                } else {
                    this.WaitListS()
                }
            },
            //  诊疗号搜索
            searchs() {
                this.GetWaitList()
            },
            // 已录入列表
            EntryList() {
                this.date = dayjs(this.date).format('YYYY-MM-DD')
                const config = {
                    page: this.pages,
                    pageSizes: this.pageSizes,
                    keyword: this.keywords2,
                    clinic_project_id: this.clinic_project_ids,
                    day: this.date
                }
                GetEntryList(config).then(res => {
                    this.waitLists = res.list.treatmentList
                    this.dataTotal = parseInt(res.list.treatment_total)
                    this.labels = '已录入' + '(' + res.list.treatment_total + ')'
                    this.clinic_project = res.clinic_project
                    for (let i = 0; i < this.waitLists.length; i++) {
                        let a = dayjs(this.waitLists[i].recently_clinic_time).format('YYYY-MM-DD')
                        let time = dayjs(new Date()).format('YYYY-MM-DD')
                        let Time = new Date() - 3 * 24 * 60 * 60 * 1000
                        let day = new Date(a).getTime()
                        if (a === time) {
                            this.waitLists[i].isShow = true
                        } else {
                            this.waitLists[i].isShow = false
                        }
                        if (Time < day) {
                            this.waitLists[i].Show = false
                        } else {
                            this.waitLists[i].Show = true
                        }
                    }
                    this.judgeWaitListS()
                })
            },
            // 查询
            GetWaitList() {
                const config = {
                    keyword: this.keywords2,
                    clinic_project_id: this.clinic_project_ids,
                    pageSize: this.pageSizes,
                    page: this.pages
                }
                WaitList(config).then(res => {
                    this.waitList = res.list.waitList
                    this.dataTotal = parseInt(res.list.wait_total)
                    this.dataTotalsing = parseInt(res.list.wait_total)
                    this.label = '待录入' + '(' + res.list.wait_total + ')'
                    this.clinic_project = res.clinic_project
                    this.judgeWaitListS()
                })
            },
            // 诊疗项目搜索
            TheQuerys() {
                this.GetWaitList()
            },
            // 判断数组长度
            judgeWaitListS() {
                if (this.waitList.length === 0) {
                    this.show = true
                } else {
                    this.show = false
                }
                if (this.waitLists.length === 0) {
                    this.shows = true
                } else {
                    this.shows = false
                }
            },
            // 开始治疗
            handleAddTreatment(row, index) {
                this.oldId = row.id
                this.getConfigId.clinic_project_id = row.clinic_project_id
                const config = {
                    patient_card_id: this.keywords,
                    clinic_project_id: row.clinic_project_id
                }
                NewTreatment(config).then(res => {
                    row.recently_clinic_time = res.recently_clinic_time
                    this.$set(row, 'recently_clinic_num', res.recently_clinic_num.toString())
                    this.$set(row, 'treatment_room_id', res.treatment_room_id)
                    this.$set(row, 'recently_surplus_num', res.recently_surplus_num.toString())
                    this.getConfigId.treatment_room_id = res.treatment_room_id
                })
                this.$refs.TemplateFore.templateList(row, row.template, this.waitList[index].clinic_project_name, 2, this.getConfigId, 1, 1)
            },
            // 切换每页展示的数量
            handleChangepageSize(e) {
                this.pageSizes = e
                if (this.tab === '1') {
                    this.WaitListS()
                } else {
                    this.EntryList()
                }
            },
            // 分页
            handleChangePage(e) {
                this.pages = e
                if (this.tab === '1') {
                    this.WaitListS()
                } else {
                    this.EntryList()
                }
            },
            // 弹出框确认
            confirms() {
                this.tabPane = '1'
                this.AddclinicLists()
            },
            // 弹出框取消
            ShutDown() {
                this.DataList = []
            },
            // // 复选框选择
            // TheQuery(e) {
            //     this.DataList = e
            // },
            // 复选框选择
            TheQuery(checked, name) {
                for (let item of this.data.list) {
                    if (this.data.tableList === item.patient_card_id) {
                        if (checked) item.clinic_project_ids.push(name)
                        else {
                            let index = item.clinic_project_ids.indexOf(name)
                            item.clinic_project_ids.splice(index,1)
                        }
                    }
                }
                // this.DataList = e
            },
            // 完善姓名
            setName() {
                if (this.DataName.length === 0) {
                    if (this.names === true) {
                        this.num = parseInt(this.improved)
                        this.improved = (this.num - 15) + "%"
                        this.names = false
                    }
                } else {
                    if (this.names === false) {
                        let reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
                        if (reg.test(this.DataName)) {
                            this.num = parseInt(this.improved)
                            this.improved = (this.num + 15) + "%"
                            this.names = true
                        } else {
                            this.$Message.info('请输入中文名字')
                        }
                    }
                }
            },
            // 切换分页
            switchsa(e) {
                this.page = 1
                this.pageSize = 10
                this.searchForm.outpatient_type_id = ''
                this.searchForm.keywords = ''
                this.searchForm.tags_id = ''
                this.name = e
                if (e === '1') {
                    this.onLoad()
                } else if (e === '2') {
                    this.getData()
                } else if (e === '3') {
                    this.$refs.tasklist.initial()
                }
            },
            // // 完善手机号
            // perfectss() {
            //     console.log(this.perfect.mobile)
            //     console.log(this.improved)

            //     // if()

            //     if (this.isShow === false) {
            //         let phone = /^[1][3,4,5,7,8,9][0-9]{9}$/
            //         if (phone.test(this.perfect.mobile)) {
            //             if (parseInt(this.improved) >= 100) {
            //                 return false;
            //             }
            //             this.num = parseInt(this.improved)
            //             this.improved = (this.num + 15) + "%"
            //         }
            //     }
            // },
            // 完善手机号
            perfects() {
                if (this.perfect.mobile.length === 0) {
                    // if (this.isShow === true) {

                    if (parseInt(this.improved) >= 100) {
                        return false;
                    }
                    this.num = parseInt(this.improved)
                    this.improved = (this.num - 15) + "%"
                    this.isShow = false
                    // }
                } else if (this.perfect.mobile.length === 11) {
                    // console.log(22)
                    // console.log(this.isShow)

                    // if (this.isShow === false) {
                    let phone = /^[1][3,4,5,7,8,9][0-9]{9}$/
                    if (phone.test(this.perfect.mobile)) {

                        if (parseInt(this.improved) >= 100) {
                            return false;
                        }
                        this.num = parseInt(this.improved)
                        this.improved = (this.num + 15) + "%"
                        this.isShow = true
                    } else {
                        this.$Message.info('请输入正确的手机号')
                        this.perfect.mobile = ''
                    }
                    // }
                } else if (this.perfect.mobile.length > 11) {
                    this.$Message.info('请输入正确的手机号')
                }
            },

            // 完善标签
            changeTag() {
                if (this.could_update1) {
                    if (this.couldUpdate1 === true) {
                        if (this.perfect.tagsState_id.length != 0) {
                            if (this.improved >= 100) {
                                return false;
                            }
                            this.num = parseInt(this.improved)
                            this.improved = this.num + 10
                            this.couldUpdate1 = false
                        }
                    } else if (this.couldUpdate1 === false) {

                    }
                }
                if (this.perfect.tagsState_id.length === 0) {
                    this.num = parseInt(this.improved)
                    this.improved = this.num - 10
                    this.couldUpdate1 = true
                }
            },

            // 完善病种
            progress() {
                if (this.could_update) {
                    if (this.couldUpdate === true) {
                        if (this.perfect.body_parts_id.length != 0) {
                            if (this.improved >= 100) {
                                return false;
                            }
                            this.num = parseInt(this.improved)
                            this.improved = this.num + 10
                            this.couldUpdate = false
                        }
                    } else if (this.couldUpdate === false) {
                    }
                }
                if (this.perfect.body_parts_id.length === 0) {
                    this.num = parseInt(this.improved)
                    this.improved = this.num - 10
                    this.couldUpdate = true
                }
            },
            progres(e) {
                if (this.perfect.city_id === '0' || this.perfect.city_id === undefined) {
                    this.num = parseInt(this.improved)
                    this.improved = this.num + 10
                }
            },
            progre(e) {
                if (this.perfect.patient_diseases_id === '0' || this.perfect.patient_diseases_id === undefined) {
                    this.num = parseInt(this.improved)
                    this.improved = this.num + 10
                }
            },
            riskProgre(value) {
                if (this.perfect.risk_type_list_id === '0' || this.perfect.risk_type_list_id === undefined) {
                    this.perfect.risk_type_list_id = value.value
                    this.num = parseInt(this.improved)
                    this.improved = this.num + 10
                }
            },

            effectProgre(value) {
                if (this.perfect.effect_type_list_id === '0' || this.perfect.effect_type_list_id === undefined) {
                    this.perfect.effect_type_list_id = value.value
                    this.num = parseInt(this.improved)
                    this.improved = this.num + 10
                }
            },

            initTime() { // 判断时间
                const that = this;
                /* 判断时间段的函数 */
                var time = parseInt(new Date().getHours()); // 返回小时数
                if (time > 7 && time < 11) {
                    that.timeStr = '早上好，' + that.info.realname + '，开始您一天的工作吧！'
                } else if (time >= 11 && time < 13) {
                    that.timeStr = '中午好，' + that.info.realname + '，工作之余也要多休息！'
                } else if (time >= 13 && time < 18) {
                    that.timeStr = '下午好，' + that.info.realname + '，工作之余也要多休息！'
                } else {
                    that.timeStr = '晚上好，' + that.info.realname + '，工作之余也要多休息！'
                }
            },
            // 路由
            handleJumpPage(page) {
                let objOne = { page: page, belong: this.callData.belong_member_id, data: page === 'overdue' ? -1 : 1 }
                window.localStorage.setItem('jumpDetail', JSON.stringify(objOne))
                switch (this.profession_type) {
                    case 1:
                        switch (page) {
                            case 'visit':
                                this.changeReturnVisitTab("tableDHF")
                                this.$router.push({ name: 'home-returnVisit-list' })
                                break
                            case 'visitNo':
                                this.changeReturnVisitTab("tableYHF")
                                this.$router.push({ name: 'home-returnVisit-list' })
                                break
                            case 'patient':
                                this.$router.push({ name: 'home-patient-serveList' })
                                break
                            case 'overdue':
                                this.changeReturnVisitTab("tableGQWHF")
                                this.$router.push({ name: 'home-returnVisit-list' })
                                break
                        }
                        break
                    case 2:
                        switch (page) {
                            case 'visit':
                                this.changeMedicalListTab("tableDHF")
                                this.$router.push({ name: 'home-returnVisit-medicalList' })
                                break
                            case 'visitNo':
                                this.changeMedicalListTab("tableYHF")
                                this.$router.push({ name: 'home-returnVisit-medicalList' })
                                break
                            case 'patient':
                                this.$router.push({ name: 'home-returnVisit-transfer' })
                                break
                            case 'overdue':
                                this.changeMedicalListTab("tableGQWHF")
                                this.$router.push({ name: 'home-returnVisit-medicalList' })
                                break
                        }
                        break
                }
            },
            handleDetailPatient(row) {
                this.patientId = row.id
                this.showTetailDrawer = true

                // this.$store.commit('admin/page/setPatientDetail', { patientId: row.id, edit_type: '' })
                // this.$router.push('/patient/detail')
            },
            initWeather() {
                const that = this;
                // 去到当前电脑ip
                // eslint-disable-next-line no-undef
                const cip = returnCitySN['cip'];
                axiosApi
                    .get('https://www.tianqiapi.com/api/?appid=41678296&appsecret=ZKo4gjcw&version=v6&ip=' + cip)
                    .then(function (response) {
                        that.weatherData = {
                            type: response.data.wea,
                            low: response.data.tem2 + '℃',
                            high: response.data.tem1 + '℃'
                        }
                        that.weatherTips = response.data.air_tips
                    })
                    .catch(function (error) {
                        // console.log(error);
                    });
            },
            onLoad() {
                /**
                 * @description 工作台
                 */
                const params = this.getParam();
                params.sort_degree_type = this.sort_degree_type
                params.last_callback_time_type = this.last_callback_time_type
                params.next_revisiting_time_type = this.next_revisiting_time_type
                params.last_revisiting_time_type = this.last_revisiting_time_type
                params.sort_missed_type = this.sort_missed_type
                params.sort_revisiting_type = this.sort_revisiting_type
                this.loading = true
                GetToDoList(params).then((res) => {
                    this.data = this.fliteItem(res.list.list);
                    this.page = res.list.page;
                    this.pageSize = res.list.pageSize;
                    this.total = res.list.total;
                    this.labelList = res.tagsState;
                    this.typeList = res.marketing_stage;
                    this.callData = res.callbackData
                    this.profession_type = res.profession_type
                }).finally(() => {
                    this.loading = false
                })
            },
            addTitle(arr, name) {
                arr.forEach(e => {
                    e.title = e[name]
                    e.value = e['id']
                    if (e.children && e.children.length) {
                        this.addTitle(e.children, name)
                    }
                })
                return arr
            },
            getData() {
                const params = this.getParam()
                this.loading = true
                params.sort_degree_type = this.sort_degree_type
                params.last_callback_time_type = this.last_callback_time_type
                params.next_revisiting_time_type = this.next_revisiting_time_type
                params.last_revisiting_time_type = this.last_revisiting_time_type
                params.sort_missed_type = this.sort_missed_type
                params.sort_revisiting_type = this.sort_revisiting_type
                GetUnImproved(params).then((res) => {
                    this.arr = res.list.list
                    this.body_parts = res.body_parts
                    this.gender = res.gender
                    // this.city = res.city
                    let list = res.city.map(item => {
                        return {
                            key: item.id + item.name,
                            id: item.id,
                            name: item.name
                        };
                    })
                    this.city_list = list
                    this.page = res.list.page;
                    this.pageSize = res.list.pageSize;
                    this.total = res.list.total;
                    this.marketing_stage = res.marketing_stage
                    this.patient_diseases = res.patient_diseases
                    this.tagsState = this.addTitle(res.tagsState, 'name')
                    // console.log(this.tagsState)
                    this.effect_type_list = res.effect_type_list
                    this.risk_type_list = res.risk_type_list
                }).finally(() => {
                    this.loading = false
                })
            },
            getParam() {
                let param = {
                    page: this.page,
                    pageSize: this.pageSize
                }
                param = Object.assign(param, this.searchForm)
                return param
            },
            fliteItem(arr) {
                let reArr = [];
                if (arr && arr.length > 0) {
                    arr.forEach((item) => {
                        const reItem = item;
                        let genderStr = '不详';
                        if (item.gender === '1') genderStr = '男'
                        else if (item.gender === '2') genderStr = '女'
                        item.basic = item.name + ' ' + genderStr + ' ' + item.age + '岁';
                        reArr.push(reItem);
                    })
                }
                return reArr;
            },
            changePage(page) {
                this.page = page;
                if (this.name === '1') {
                    this.onLoad();
                } else {
                    this.getData()
                }
            },
            changepageSize(pageSize) {
                this.pageSize = pageSize;
                if (this.name === '1') {
                    this.onLoad();
                } else {
                    this.getData()
                }
            },
            onSearch(data) {
                this.page = 1
                this.pageSize = 10
                this.searchForm = this.filterSearch(data);
                if (this.name === '1') {
                    this.onLoad();
                } else {
                    this.getData()
                }
            },
            filterSearch(data) {
                return {
                    keywords: data.name,
                    outpatient_type_id: data.diagnosis,
                    tags_id: (data.label).join(',')
                }
            },
            formDate(date) {
                return formatWithYear(date, '-')
            },
            handleSubmit(row) {
                this.$refs.editModel.handleShow(row, this.typeList, this.labelList)
            },
            Submitsss(row) {
                this.is_first_initially = row.is_first_initially
                this.improved = 0
                let num = 0
                if (row.name !== "" && row.name !== "0") {
                    num += 15
                }
                if (row.city_id !== "" && row.city_id !== "0") {
                    num += 10
                }
                if (row.mobile !== "" && row.mobile !== "0") {
                    num += 15
                }
                if (row.gender !== "" && row.gender !== "0") {
                    num += 10
                }
                if (row.effect_type_id !== "" && row.effect_type_id !== "0") {
                    num += 10
                }
                if (row.risk_type_id !== "" && row.risk_type_id !== "0") {
                    num += 10
                }
                if (row.patient_diseases_id !== "" && row.patient_diseases_id !== "0") {
                    num += 10
                }
                if (row.body_parts_id && row.body_parts_id.length) {
                    num += 10
                }
                if (row.patient_tags_name_arr && row.patient_tags_name_arr.length) {
                    num += 10
                }
                this.perfect = JSON.parse(JSON.stringify(row))
                this.perfect.tagsState_id = []
                this.perfect.city_id = row.city_id + row.city_name
                this.body_parts_id = row.body_parts_id
                this.perfect.effect_type_list_id = row.effect_type_id
                this.perfect.risk_type_list_id = row.risk_type_id
                this.effect_type_list_id = row.effect_type_id
                this.risk_type_list_id = row.risk_type_id
                this.patient_diseases_id = row.patient_diseases_id
                this.city_id = row.city_id
                this.mobile = row.mobile
                this.getvalue(row.patient_tags_name_arr, this.tagsState)
                this.disabledSingle = parseInt(row.gender)
                this.improved = num + "%"
                this.DataName = this.perfect.name
                this.modal1 = !this.modal1
            },
            getvalue(arr1, arr2) {
                arr1.forEach(ee => {
                    arr2.forEach(vv => {
                        if (vv.title == ee) {
                            let flag = this.perfect.tagsState_id.find(nn => nn == vv.value)
                            if (!flag) {
                                this.perfect.tagsState_id.push(vv.value)
                            }
                        }
                        if (vv.children && vv.children.length) {
                            this.getvalue(arr1, vv.children)
                        }
                    })
                })
            },
            async ok(e) {
                if (!this.DataName) {
                    this.$Message.info('请填写姓名')
                    return false
                }
                let phone = /^[1][3,4,5,7,8,9][0-9]{9}$/
                if (!phone.test(this.perfect.mobile)) {
                    this.$Message.info('请输入正确的手机号');
                    // this.perfect.mobile = ''
                    return
                }
                if (this.perfect.patient_diseases_id === '0') {
                    this.perfect.patient_diseases_id = ''
                }
                if (this.perfect.city_id === '0') {
                    this.perfect.city_id = ''
                }
                const config = {
                    name: this.DataName,
                    gender: this.perfect.gender,
                    mobile: this.perfect.mobile,
                    city_id: this.perfect.city_id || '',
                    patient_diseases_id: this.perfect.patient_diseases_id || '',
                    patient_id: this.perfect.id,
                    body_part_id: (this.perfect.body_parts_id && this.perfect.body_parts_id.length) ? this.perfect.body_parts_id.join(',') : '',
                    effect_type_id: this.perfect.effect_type_list_id || '',
                    risk_type_id: this.perfect.risk_type_list_id || '',
                    patient_tags_name: (this.perfect.tagsState_id && this.perfect.tagsState_id.length) ? this.perfect.tagsState_id.join(',') : ''
                }
                GetImproved(config).then(res => {
                    this.modal1 = false
                    this.getData()
                })
            },
            cancel() {
                this.perfect.body_parts_id = this.body_parts_id
                this.perfect.patient_diseases_id = this.patient_diseases_id
                this.perfect.city_id = this.city_id
                this.perfect.tagsState_id = this.city_id
                this.perfect.effect_type_list_id = this.city_id
                this.perfect.risk_type_list_id = this.city_id
                this.perfect.mobile = this.mobile
                this.isShow = true
                this.modal1 = false
            },
            closeEdit(val) {
                if (val) {
                    this.onLoad();
                }
            },
            AddclinicLists() {

                // const config = {
                //     patient_card_id: this.keywords,
                //     clinic_project_id: this.data.clinic_project_ids.join(',')
                // }
                // AddclinicList(config).then(res => {
                //     this.WaitListS()
                // })

                for (let item of this.data.list) {
                    if (this.data.tableList === item.patient_card_id) {
                        const config = {
                            patient_card_id: this.data.tableList,
                            clinic_project_id: item.clinic_project_ids.join(',')
                        }
                        AddclinicList(config).then(res => {
                            this.WaitListS()
                        })
                    }
                }
            },
            WaitListS() {
                const config = {
                    keyword: this.keywords2,
                    pageSize: this.pageSizes,
                    page: this.pages
                }
                WaitList(config).then(res => {
                    this.waitList = res.list.waitList
                    this.dataTotals = parseInt(res.list.wait_total)
                    this.dataTotalsing = parseInt(res.list.total)
                    this.label = '待录入' + '(' + res.list.wait_total + ')'
                    this.clinic_project = res.clinic_project
                    this.judgeWaitListS()
                })
            },
            search() {
                if (this.keywords) {
                    this.keywords2 = ''
                    const config = {
                        patient_card_id: this.keywords
                    }
                    clinicList(config).then(res => {
                        if (res.list.length) {
                            this.data = res
                            this.modal3 = true
                        }
                    })
                }

                //  this.keywords2 = ''
                // const config = {
                //     patient_card_id: this.keywords
                // }
                // clinicList(config).then(res => {
                //     if (res.name === '' || res.name === undefined) {

                //     } else {
                //         this.data = res
                //         this.modal3 = true
                //     }
                // })

            },
            // 录入成功
            putMessage() {
                if (this.tab === '1') {
                    this.WaitListS()
                } else {
                    this.EntryList()
                }
            }
        },
        computed: {
            ...mapState('admin/user', [
                'info'
            ])
        }
    }
</script>
<style lang="less" scoped>
    .i-layout-page-header .ivu-page-header {
        background-color: transparent;
    }

    .dashboard-workplace-header-avatar {
        vertical-align: middle;
    }

    .dashboard-workplace-header-extra .ivu-col p:last-child {
        font-size: 12px !important;
    }

    .dashboard-workplace {
        &-header {
            &-avatar {
                width: 64px;
                height: 64px;
                border-radius: 50%;
                margin-right: 16px;
            }

            &-tip {
                display: inline-block;
                vertical-align: middle;

                &-title {
                    font-size: 20px;
                    font-weight: bold;
                    margin-bottom: 12px;
                }

                &-desc {
                    color: #808695;
                }
            }

            &-extra {
                min-width: 320px;

                .ivu-col {
                    p {
                        text-align: right;
                    }

                    p:first-child {
                        span:first-child {
                            margin-right: 4px;
                        }

                        span:last-child {
                            color: #808695;
                        }
                    }

                    p:last-child {
                        font-size: 22px;
                    }
                }
            }
        }
    }

    .i-layout-page-header .dashboard-workplace-header-extra .ivu-col .colorL {
        font-size: 22px !important;
        color: #10b550;

        .ivu-tooltip-rel {
            font-size: 22px !important;
            color: #10b550;
        }
    }

    .time {
        font-size: 14px;
        font-weight: bold;
    }

    .content {
        padding: 10px 0;
    }

    4 span {
        margin-left: 5px;
    }

    .title {
        font-weight: bold;
        font-size: 16px;
        padding: 24px 0 0 24px;
    }

    .colorT {
        font-size: 14px !important;
    }

    .blueStatus {
        line-height: 20px;
        background: #e6fffb;
        border-color: #87e8de;
        font-size: 12px;
        color: #13c2c2 !important;
    }

    .daibansx {
        .ivu-tabs-bar {
            margin-bottom: 0;
        }

        .ivu-tabs-content {
            .ivu-mt {
                margin-top: 0 !important;
            }
        }
    }

    .ivu-form-item-content {
        position: relative;
    }

    .requiceIcon {
        position: absolute;
        left: -10px;
        top: 10px;
        margin-right: 4px;
        line-height: 1;
        font-family: SimSun;
        font-size: 14px;
        color: #ed4014;
    }
    .searchinput{
        /deep/.ivu-input-suffix i{
            line-height: 50px;
        }
        /deep/.ivu-input{
            height: 50px
        }
    }
</style>